import Vue from "vue";
import App from "./App.vue";
// 引入路由
import router from "./router";
//引入vuex
import store from "./store";
// http请求工具axios
import axios from "axios";
Vue.prototype.$http = axios;
// 配置请求的根路径
axios.defaults.baseURL = "http://api.xiaomadagege.cn:8800/api/private/v1/";
// 全局拦截
import setaxios from "./setaxios";
setaxios();
//引入ElementUI框架
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);
//导入字体图标
import "./assets/fonts/iconfont.css";
//引入全局样式表
import "./assets/css/global.css";
// 引入表格插件
import TreeTable from "vue-table-with-tree-grid";
Vue.component("tree-table", TreeTable);
Vue.use(TreeTable);
// 时间格式化过滤器
Vue.filter("dateFormat", function(originVal) {
  const dt = new Date(originVal);

  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + "").padStart(2, "0");
  const d = (dt.getDate() + "").padStart(2, "0");

  const hh = (dt.getHours() + "").padStart(2, "0");
  const mm = (dt.getMinutes() + "").padStart(2, "0");
  const ss = (dt.getSeconds() + "").padStart(2, "0");

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});
// 引入富文本编辑器
import VueQuillEditor from "vue-quill-editor";
// require styles 引入富文本编辑器对应的样式
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
// 将富文本编辑器 注册全局可用组件
Vue.use(VueQuillEditor);

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
